package com.hwadee.job.service.impl;

import java.util.List;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.hwadee.job.dao.AdminMapper;
import com.hwadee.job.dao.CompanyMapper;
import com.hwadee.job.dao.RecruitMapper;
import com.hwadee.job.dao.StudentInfoMapper;
import com.hwadee.job.dao.UserMapper;
import com.hwadee.job.entity.Admin;
import com.hwadee.job.entity.Company;
import com.hwadee.job.entity.Recruit;
import com.hwadee.job.entity.StudentInfo;
import com.hwadee.job.entity.User;
import com.hwadee.job.service.AdminService;
import com.hwadee.job.util.PageInfo;
@Service
public class AdminServiceImpl implements AdminService {
	
	@Autowired
	private UserMapper usermapper;
	@Autowired
	private AdminMapper adminmapper;
	@Autowired 
	private StudentInfoMapper stumapper;
	@Autowired
	private RecruitMapper remapper;
	@Autowired
	private CompanyMapper commapper;

	@Override
	public User selectByPrimaryKey(Integer id) {
		return usermapper.selectByPrimaryKey(id);
	}

	@Override
	public Admin selectByZh(String zh) {
		return adminmapper.selectByZh(zh);
	}

	@Override
	public StudentInfo selectBysIdnumber(String sIdnumber) {
		return stumapper.selectBysIdnumber(sIdnumber);
	}

	@Override
	public List<StudentInfo> select() {
		return stumapper.select();
	}

	@Override
	public int insertstu(StudentInfo record) {
		// TODO Auto-generated method stub
		return stumapper.insert(record);
	}

	@Override
	public int deleteByPrimaryKey(Integer id) {
		// TODO Auto-generated method stub
		return stumapper.deleteByPrimaryKey(id);
	}

	@Override
	public StudentInfo selectByKey(Integer id) {
		// TODO Auto-generated method stub
		return stumapper.selectByPrimaryKey(id);
	}

	@Override
	public List<Recruit> selectRecruit() {
		// TODO Auto-generated method stub
		return remapper.selectRecruit();
	}

	@Override
	public int inserrecruit(Recruit recru) {
		// TODO Auto-generated method stub
		return remapper.insert(recru);
	}

	@Override
	public int deleteByrecruitKey(Integer id) {
		// TODO Auto-generated method stub
		return remapper.deleteByPrimaryKey(id);
	}

	@Override
	public Recruit selectByRecruitkey(Integer id) {
		// TODO Auto-generated method stub
		return remapper.selectByPrimaryKey(id);
	}
	//学生分页
	@Override
	public List<StudentInfo> findAll(int page, int size) {
		// TODO Auto-generated method stub
		//pageNum代表页码值，pageSize代表每页条数
        PageHelper.startPage(page,size);
		return stumapper.select();
	}
	//招聘信息分页
	@Override
	public List<Recruit> findAllRecruit(int page, int size) {
		// TODO Auto-generated method stub
		PageHelper.startPage(page,size);
		return remapper.selectRecruit();
	}
	//企业分页
	@Override
	public List<Company> findAllCompany(int page, int size) {
		// TODO Auto-generated method stub
		PageHelper.startPage(page,size);
		return commapper.selectCompany();
	}
	//删除企业
	@Override
	public int deleteBycompanyKey(Integer id) {
		// TODO Auto-generated method stub
		return commapper.deleteByPrimaryKey(id);
	}

	

	

	

}
